package org.wendu.wdoa.dep.dao;

import org.apache.ibatis.annotations.*;
import org.wendu.wdoa.common.page.PageParam;
import org.wendu.wdoa.dep.dto.DepDto;
import org.wendu.wdoa.dep.model.Department;


import java.util.List;

@Mapper
public interface DepartmentDao {
    //@Select("select * from t_dep")
    public List<Department> findDepList(PageParam pageParam);
    @Select("select count(e.d_id) from t_emp e left join t_dep d on e.d_id=d.d_id where e.d_id=#{d_id}")
    boolean findExistsId(Integer d_id);
    @Delete("delete from t_dep where d_id=#{id}")
    void deleteDepName(Integer d_id);
    @Select("select ifnull(max(convert(d_id,unsigned)),0)+1 from t_dep")
    Integer findNewId();
    @Insert("insert into t_dep(d_id,d_name) values(#{d_id},#{d_name})")
    void insertDep(DepDto depDto);
    @Update("update t_dep set d_name=#{d_name} where d_id=#{d_id} ")
    void updateDepData(Department department);
}
